<?php
require_once 'galleryfrompicasa.class.php';
class photos {
	var $db;
 	var $smarty;	
	public function __construct($db, $smarty,$page='',$cat='',$product='') {
		$this->db = $db;
		$this->smarty = $smarty;
		$this->page = $page;
		$this->cat = $cat;
		$this->product = $product;
	}
	
	public function main() {
		$gallery=new GalleryFromPicasa();
        $user_picasaweb=GUSER;

		$albumid ='';
		$albums=$gallery->getAlbums($user_picasaweb,"61c");
		if($this->cat==''){
			foreach ($albums AS $key=>$value) {
				 $albumid = $key;break;
			}
		}else{
			 $albumid = $this->cat;
		}
			
        if (isset($albumid) && $albumid!="") {
            $pictures=$gallery->getPictures($user_picasaweb, $albumid,"32c");
           // foreach ($pictures AS $key=>$value) {
           //     echo "<img src=\"" . $value['thumbnail']  . "\" alt=\"" . $value['title'] . "\"><a href=\"index.php?pic=" . $value['picture'] . "\">" . $value['title'] . "</a><br/>\n";
           // }
        }
       
       
        //foreach ($albums AS $key=>$value) {
              //  echo "<img src=\"" . $value['thumbnail']  . "\" alt=\"" . $value['title'] . "\"><a href=\"index.php?gal=" . $key . "\">" . $value['title'] . "</a><br/>\n";
			  
      //  }
			
       	$this->smarty->assign("LISTPHTOTOS",   $pictures);	
		$this->smarty->assign("LISTALBUM",  $albums);	
		$this->smarty->display("photos.tpl");	
	}
	
	
	
}
?>
